<?php namespace Admin\Controller; 

//站点配置控制器
class WebSetController extends CommonController{
	public function index(){
		$model=new \Common\Model\WebSet;
		if(IS_POST){
//			p(Q('post.'));
			//1.修改数据
			foreach (Q('post.') as $name =>$value){
				//update webset set value=''where name=''
				$date=$model->where("name='{$name}'")->save(array('value'=>$value));
			}
			//2.修改配置项
			file_put_contents('./Config/WebSet.php', "<?php \r\nreturn " . var_export(Q('post.'),true) . ";");
//			file_put_contents('./Config/webSet.php', "<?php \r\nreturn " . var_export(Q('post.'),true) . ";");
			View::success("修改成功");
		}
		
		
		//一.显示数据
		$data=$model->get();
//		p($data);
		View::with('data',$data);
		
		View::make();


	}
	
	
}